package com.rongxun.widget;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.rongxun.hbwallet.MyApp;
import com.rongxun.hbwallet.R;

/**
 * 创建者     庄丰泽
 * 创建时间   2018/8/11 10:00
 * 描述
 */
public class MentionMoneyDialog extends Dialog {

    public MentionMoneyDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }
    public static class Builder implements View.OnClickListener {
        private Context context;
        private MentionMoneyDialog dialog;
        private double money_number;//提币数量
        private double Miners_fee;//矿工费
        private Button but_quick;
        private ImageView dialog_mention_close;
        public void setMoney_number(double money_number) {
            this.money_number = money_number;
        }
        public void setMiners_fee(double miners_fee) {
            Miners_fee = miners_fee;
        }
        public Builder(Context context) {
            this.context = context;
        }
        public MentionMoneyDialog create() {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            dialog = new MentionMoneyDialog(context, R.style.Dialog);
            View layout = inflater.inflate(R.layout.dialog_mentionmoney, null);
            but_quick=(Button)layout.findViewById(R.id.dialog_mention_money_quick);
            dialog_mention_close=(ImageView)layout.findViewById(R.id.dialog_mention_close);
            dialog.getWindow().setWindowAnimations(R.style.anim_menu_bottombar);
            dialog.getWindow().setGravity(Gravity.BOTTOM);
            dialog.addContentView(layout, new LinearLayout.LayoutParams(
                    MyApp.SCREEN_WIDTH, LinearLayout.LayoutParams.WRAP_CONTENT));
            dialog_mention_close.setOnClickListener(this);
            but_quick.setOnClickListener(this);
            return dialog;
        }
        @Override
        public void onClick(View v) {
            if (v.getId() == R.id.dialog_mention_close) {
                  if(dialog!=null){
                      dialog.dismiss();
                  }
            }else if(v.getId()==R.id.dialog_mention_money_quick){
                MentionMoneyPasswordDialog.Builder builder=new  MentionMoneyPasswordDialog.Builder(context);
                builder.create().show();
            }
        }
    }
}

